<?php
namespace utils;

class MimeMapping
{   
    public $mimes = array(
                "html"=>"text/html",
                "htm"=>"text/html",
                "txt"=>"text/plain",
                "jpg"=>"image/jpeg",
                "gif"=>"image/gif",
                "png"=>"image/png",
                "mpeg"=>"image/mpeg",
                ""=>"application/octet-stream",
                "pdf"=>"application/pdf",
                "doc"=>"application/msword",
                "docx"=>"application/msword",
            );

    function __construct() 
    {
    }

    /*
     * 
     */
    public static function getType($a)
    {
        $mm = new MimeMapping();
        $ext = PathTool::getExtention($a);
        $ext = strtolower($ext);        
        if(key_exists($ext,$mm->mimes))
        {
            return $mm->mimes[$ext];
        }
        return $mm->mimes[""];
    }
}
?>